package org.grayrabbit.cms.publish.generate;

import org.grayrabbit.cms.publish.api.Publishable;


public class SurveryMission extends Mission{
	private int currentSurveryIndex;
	
	public int getCurrentSurveryIndex() {
		return currentSurveryIndex;
	}

	public void setCurrentSurveryIndex(int currentSurveryIndex) {
		this.currentSurveryIndex = currentSurveryIndex;
	}

	public boolean hasNext() {
		return currentSurveryIndex<this.getSurveryNum();
	}

	public void remove() {
		
	}

	@Override
	public GenTask next() {
		if(currentSurveryIndex<this.getSurveryNum()){
			GenTask task = new GenTask();
			task.setList(getList());
			task.setType(Publishable.SURVEY_GEN);
			task.setMission(this);
			task.setAdmin(getAdmin());
			if(getList().size()==0){
				currentSurveryIndex = this.getSurveryNum();
			}else{
				currentSurveryIndex+=getList().size();
			}
			return task;
		}
		return null;
	}
}